
<%@page import="book.util.Book"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'bookan.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
 	<h1>查看书籍</h1>
 	<a href="booker.jsp">返回</a><br>
 	
 	<a href="jsp/addad.jsp?">添加图书</a> <br> 
 	<a href="jsp/update.jsp?book_id=${book.book_id}">换改</a><br>
 	
 	 <%List<Book> bklist=(List)session.getAttribute("book"); %>
 	<table border="1" align="center" width="500">
 	<tr>
 	<td>book_id</td>
 	<td>type</td>
 	<td>title</td>
 	<td>publisher</td>
 	<td>year</td>
 	<td>author</td>
 	<td>price</td>
 	<td>number</td>
 	<td>stocks</td>
 	
 	</tr>
 	<c:choose> 
  <c:when test="${empty bklist}"> 
 	
 	 <c:redirect url="../bookServlet?opr=findAllbook"></c:redirect>  
  	<% response.sendRedirect("../bookServlet?opr=findAllbook"); %> 
 	 </c:when> 
 	 <c:otherwise> 
 	 <c:forEach items="${bklist}" var="book"> 
 
 	<tr>
 <%-- 	<td><%=book.getBook_id()%></td>
 	<td><%=book.getType()%></td> 
 	<td><%=book.getTitle()%></td>
 	<td><%=book.getPublisher()%></td>
 	<td><%=book.getYear()%></td>
 	<td><%=book.getAuthor()%></td>
 	<td><%=book.getPrice()%></td>
 	<td><%=book.getNumber()%></td>
 	<td><%=book.getStocks()%></td> --%>
 	<td>${book.book_id}</td>
 	<td>${book.type}</td>
 	<td>${book.title}</td>
 	<td>${book.publisher}</td>
 	<td>${book.year}</td>
 	<td>${book.author}</td>
 	<td>${book.price}</td>
 	<td>${book.number}</td>
 	<td>${book.stocks}</td> 
	<td><a href="bookServlet?opr=del&book_id=${book.book_id}">删除图书</a>
 	</td>
 	</tr>
 	
 	</c:forEach> 
  	</c:otherwise>
 	</c:choose> 
 	</table>

  </body>
</html>
